const pool = require('../utils/utils.js')

module.exports = async function(ctx,next){
  var res = await new Promise((resolve,reject)=>{
    if(ctx.query.userid){
      sqlStr = 'SELECT * FROM bookCase where userid=' + ctx.query.userid
    }
    console.log(sqlStr);
    pool.query(sqlStr, (err, result) => {
      if (err) {
        reject(err)
      } else {
        resolve(result)
      }
    })
  })
  ctx.body = res
  await next()
}